package com.zzyl.mapper;

import com.zzyl.entity.Bed;
import com.zzyl.vo.BedVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BedMapper {

    List<BedVo> getBedsByRoomId(Long roomId);

    @Insert("insert into bed (bed_number, bed_status, sort, room_id, create_time, update_time, create_by, update_by, remark) " +
            "VALUES (#{bedNumber}, #{bedStatus}, #{sort}, #{roomId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy}, #{remark})")
    void addBed(Bed bed);

    @Select("select id, bed_number, sort, bed_status, room_id " +
            "from bed where id = #{id}")
    Bed getBedById(Long id);

    void updateBed(Bed bed);

    @Delete("delete from bed where id = #{id};")
    void deleteBedById(Long id);

}

